import { _decorator, Component, Node, Vec3 } from 'cc';
import { Explosion_Bullet } from './Explosion_Bullet';
import { ZTool } from '../AshFramework/Utils/ZTool';
import { MapCamera } from './MapCamera';
import { AudioManager, Audios } from '../AshFramework/Managers/AudioManager';
const { ccclass, property } = _decorator;

enum Ani {
    None = "",
    Boom = "shouleibaozha_texiao",
}

@ccclass('Explosion_Grenade')
export class Explosion_Grenade extends Explosion_Bullet {

    show(worldPos: Vec3, angle: number, harm: number = 0, armor: number = 0) {
        this.Harm = harm;
        this.Armor = armor;
        this.node.setWorldPosition(worldPos);
        const randAngle = ZTool.GetRandom(-5, 5);
        this.node.angle = angle + randAngle;
        MapCamera.Instance.shakeCamera(6, 0.025, 15);
        AudioManager.PlaySound(Audios.Boom);
        this.playAni(Ani.Boom, false, () => {
            this.node.destroy();
        })
    }
}


